<?php
namespace App\Http\Controllers\ApiWx\Mys;

use App\DBs\GuoDB;
use App\DBs\ThingDB;
use Illuminate\Http\Request;

class MyController extends BaseController
{
    //我的

    protected $db;
    protected $thing;

    public function __construct()
    {
        parent::__construct();
        $this->db = new GuoDB();
        $this->thing = new ThingDB();
    }

    /**
     * 时价交易榜
     */
    public function getTradeIndex(Request $request)
    {
        $resDb = $this->db->getMyTradeIndex();
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data'];
        $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }

    /**
     * 我的橱窗
     */
    public function getThingIndex(Request $request)
    {
        $wx = $request->post('wx','');
        $resDb = $this->thing->getMyThingIndex($wx);
        return $resDb;
        if ($resDb['code']!=0) {
            return $this->toWxJson(-3);
        }
        $items = $resDb['data'];
        $total = $resDb['total'];
        return $this->toWxJson(0,$items,$total);
    }
}